package com.dreamteam.schooling.setting;

import com.dreamteam.schooling.R;
import com.dreamteam.schooling.R.id;
import com.dreamteam.schooling.R.layout;
import com.dreamteam.schooling.classboard.SetFriendActivity;
import com.dreamteam.schooling.classboard.SetSubjectActivity;
import com.dreamteam.schooling.timetable.SetTimetableMenuActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class SettingMenuActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting_menu);
        
        View menuItemBtn = (View)findViewById(R.id.menu_btn1);
        menuItemBtn.setOnTouchListener(new MenuItemTouchListener(new Intent(SettingMenuActivity.this, ModifyProfileActivity.class)));
        
        menuItemBtn = (View)findViewById(R.id.menu_btn2);
        menuItemBtn.setOnTouchListener(new MenuItemTouchListener(new Intent(SettingMenuActivity.this, InformationActivity.class)));  
        
        menuItemBtn = (View)findViewById(R.id.menu_btn3);
        menuItemBtn.setOnTouchListener(new MenuItemTouchListener(new Intent(SettingMenuActivity.this, SetTimetableMenuActivity.class)));
        
        menuItemBtn = (View)findViewById(R.id.menu_btn4);
        menuItemBtn.setOnTouchListener(new MenuItemTouchListener(new Intent(SettingMenuActivity.this, SetSubjectActivity.class)));
        
        menuItemBtn = (View)findViewById(R.id.menu_btn5);
        menuItemBtn.setOnTouchListener(new MenuItemTouchListener(new Intent(SettingMenuActivity.this, SetFriendActivity.class)));
    }
    
    private class MenuItemTouchListener implements OnTouchListener {
    	private Intent intent;
    	public MenuItemTouchListener(Intent intent) {
    		this.intent = intent;
    	}
    
    	@Override
		public boolean onTouch(View v, MotionEvent event) {
			
			switch(event.getAction()) {
			case MotionEvent.ACTION_DOWN:
		        startActivity(intent);
			}
			return false;
		}

    	
    }
}